To generate a histogram plot of a variable of interest, a user needs to specify the following parameters:
to retrieve data from CMAP.
Call plot_depth function to obtain plot_ly/ggplot object.
con <- dbConnect(odbc::odbc(), DSN="CMAP-MSSQL",UID="ArmLab",PWD="ArmLab2018")
# Inpit variable:
table.list <- c('tblSST_AVHRR_OI_NRT', 'tblArgoMerge_REP', 'tblArgoMerge_REP')
var.list <- c('sst', 'argo_merge_temperature_adj', 'argo_merge_salinity_adj')
# variable "sst" selected from "tblSST_AVHRR_OI_NRT"
selIndex <- 1
table.name <- table.list[selIndex]
sel.var <- var.list[selIndex]
# Range variable
range.var <- list()
range.var$lat <- c(20, 24)
range.var$lon <- c(-170, 150)
range.var$time <- c('2016-04-30', '2016-04-30')
# Subset selection:
tbl.subset <- getTableData(con, table.name, sel.var, range.var)
head(tbl.subset)
## # A tibble: 6 x 4
## lat lon time sst
## <dbl> <dbl> <date> <dbl>
## 1 20.1 -170. 2016-04-30 25.7
## 2 20.1 -170. 2016-04-30 25.7
## 3 20.1 -169. 2016-04-30 25.8
## 4 20.1 -169. 2016-04-30 25.8
## 5 20.1 -169. 2016-04-30 25.9
## 6 20.1 -169. 2016-04-30 25.9
## Plot function available for R User
# p <- plot_hist(tbl.subset,'ggplot',sel.var)
p <- plot_hist(tbl.subset,'plotly',sel.var)
p
dbDisconnect(con)